package javaweb.utility;

import org.apache.commons.beanutils.BeanUtils;

import java.lang.reflect.InvocationTargetException;
import java.util.Map;

/**
 * @author shkstart
 * @creat -07-25 20:45
 */
public class WebUtils {
    public static <T> T copyParamToBean(Map value, T bean) {
        try {
            BeanUtils.populate(bean, value);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return bean;
    }
public static int parseInt(String p,int defaultValue){
    if (p!=null){
        return Integer.parseInt(p);
    } else {
        return defaultValue;
    }

    }
}
